Code
library(tidymodels)
library(tidyverse)
library(palmerpenguins)
Tony Duan
January 28, 2023
Rows: 344
Columns: 8
$ species <fct> Adelie, Adelie, Adelie, Adelie, Adelie, Adelie, Adel…
$ island <fct> Torgersen, Torgersen, Torgersen, Torgersen, Torgerse…
$ bill_length_mm <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, …
$ bill_depth_mm <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, …
$ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186…
$ body_mass_g <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, …
$ sex <fct> male, female, female, NA, female, male, female, male…
$ year <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007…
https://www.youtube.com/watch?v=z57i2GVcdww https://juliasilge.com/blog/palmer-penguins/
---
title: "tidy model 101"
author: "Tony Duan"
date: "2023-01-28"
categories: [R]
execute:
warning: false
error: false
format:
html:
code-fold: show
code-tools: true
---
# Get started with tidymodels and classification of penguin data
```{r}
library(tidymodels)
library(tidyverse)
library(palmerpenguins)
```
## 1. download data
```{r}
glimpse(penguins)
```
## 2.plot
```{r}
penguins %>%
filter(!is.na(sex)) %>%
ggplot(aes(flipper_length_mm, bill_length_mm, color = sex, size = body_mass_g)) +
geom_point(alpha = 0.5) +
facet_wrap(~species)
```
# Reference
https://www.youtube.com/watch?v=z57i2GVcdww
https://juliasilge.com/blog/palmer-penguins/